
package com.thor.palmmall.rest.hdmall.sales.converter;

import org.springframework.core.convert.converter.Converter;

import com.thor.commons.entity.UCN;
import com.thor.palmmall.hdmall.sales.HDMSalesInputLine;
import com.thor.palmmall.rest.hdmall.sales.MSalesInputLine;

/**
 * @author:liyang
 * @time:2017年7月25日 下午4:14:48
 * @since:1.0
 */
public class MSalesInputLineConverter implements Converter<HDMSalesInputLine, MSalesInputLine> {

  public static MSalesInputLineConverter getInstance() {
    if (instance == null)
      instance = new MSalesInputLineConverter();
    return instance;
  }

  private static MSalesInputLineConverter instance;

  private MSalesInputLineConverter() {
  }

  @Override
  public MSalesInputLine convert(HDMSalesInputLine source) {
    if (source == null) {
      return null;
    }
    MSalesInputLine target = new MSalesInputLine();
    target.setPayment(UCN.newInstance(source.getPayment()));
    target.setTotal(source.getTotal());
    return target;
  }

}
